import request from '../utils/request.js'
import { getToken } from '../utils/auth.js'

export function getUserInfoByUserPartToken() {
  return request({
    url: '/ui/partId',
    method: 'get',
    params: {
      token: getToken()
    }
  })
}

export function getUserInfoByToken() {
  return request({
    url: '/ui/',
    method: 'get'
  })
}

export function getUserInfoById(userId) {
  return request({
    url: 'user/selectAllInfo',
    method: 'get'

  })
}
export function getUserInfoByUserId(userId){
  return request({
    url: 'user/select?userId='+userId,
    method: 'get'
  })
}

export function conditionSearchUserInfo(condition) {
  return request({
    url: 'ui/condition',
    method: 'get',
    params: condition
  })
}

export function auditActivityByActId1(userId, userOldStatus, userStatus, userPwd, userType) {
  return request({
    url: 'user/changeOldStatus?userId=' + userId + '&userOldStatus=1&userStatus=' + userStatus + '&userPwd=' + userPwd + '&userType=' + userType,
    method: 'put'
  })
}

export function updateUserInfo(userBirthday, userClassName, userEmail, userId, userLevel, userName, userOrigin, userPartName, userPhone, userSex, userUpdateTime) {
  return request({
    url: '/ui/',
    method: 'put',
    params: {
      userBirthday: userBirthday,
      userClassName: userClassName,
      userEmail: userEmail,
      userId: userId,
      userLevel: userLevel,
      userName: userName,
      userOrigin: userOrigin,
      userPartName: userPartName,
      userPhone: userPhone,
      userSex: userSex,
      userUpdateTime: userUpdateTime
    }
  })
}
